SRCDIR                = .
SUBDIRS               =
DLLS                  = CmdRunner
EXES                  =


CEXTRA                = /nologo /EHsc /MD /D "_AFXDLL"
CXXEXTRA              = /nologo /EHsc /MD /D "_AFXDLL"
RCEXTRA               =
LINKEXTRA             = /nologo
# /subsystem:windows
DEFINES               =
INCLUDE_PATH          = /I. /I/home/nihui/vc2008/include \
			/I/home/nihui/vc2008/atlmfc/include \
			/I/home/nihui/vc2008/v6.0A/Include \
			/I../../SDK/include
DLL_PATH              =
DLL_IMPORTS           =
LIBRARY_PATH          = /LIBPATH:/home/nihui/vc2008/lib \
			/LIBPATH:/home/nihui/vc2008/atlmfc/lib \
			/LIBPATH:/home/nihui/vc2008/v6.0A/Lib
LIBRARIES             =

### cine sources and settings

cine_MODULE           = CmdRunner
cine_C_SRCS           =
cine_CXX_SRCS         = CmdRunner.cpp \
			CmdRunnerDialog.cpp \
			Redirect.cpp \
			stdafx.cpp
cine_RC_SRCS          = CmdRunner.rc
cine_LDFLAGS          =
cine_DLL_PATH         =
cine_DLLS             =

cine_OBJS             = $(cine_C_SRCS:.c=.obj) \
			$(cine_CXX_SRCS:.cpp=.obj) \
			$(cine_RC_SRCS:.rc=.res)



### Global source lists

C_SRCS                = $(cine_C_SRCS)
CXX_SRCS              = $(cine_CXX_SRCS)
RC_SRCS               = $(cine_RC_SRCS)


### Tools

CC = cl.exe
CXX = cl.exe
RC = RC.Exe
LINKER = link.exe


### Generic targets

all: $(SUBDIRS) $(DLLS:%=%.dll) $(EXES:%=%.exe)

### Build rules

.PHONY: all clean dummy

$(SUBDIRS): dummy
	@cd $@ && $(MAKE)

# Implicit rules

.SUFFIXES: .cpp .rc .res .obj
DEFINCL = $(INCLUDE_PATH) $(DEFINES) $(OPTIONS)

.c.obj:
	$(CC) /c $(CFLAGS) $(CEXTRA) $(DEFINCL) /Fo$@ $<

.cpp.obj:
	$(CXX) /c $(CXXFLAGS) $(CXXEXTRA) $(DEFINCL) /Fo$@ $<

.rc.res:
	$(RC) $(RCFLAGS) $(RCEXTRA) $(DEFINCL) /fo$@ $<

# Rules for cleaning

CLEAN_FILES     = y.tab.c y.tab.h lex.yy.c core *.orig *.rej \
                  \\\#*\\\# *~ *% .\\\#*

clean:: $(SUBDIRS:%=%/__clean__) $(EXTRASUBDIRS:%=%/__clean__)
	$(RM) $(CLEAN_FILES) $(RC_SRCS:.rc=.res) $(C_SRCS:.c=.obj) $(CXX_SRCS:.cpp=.obj)
	$(RM) $(DLLS:%=%.dll) $(EXES:%=%.exe)

$(SUBDIRS:%=%/__clean__): dummy
	cd `dirname $@` && $(MAKE) clean

$(EXTRASUBDIRS:%=%/__clean__): dummy
	-cd `dirname $@` && $(RM) $(CLEAN_FILES)


DEFLIB = $(LINKEXTRA) $(LIBRARY_PATH) $(LIBRARIES) $(DLL_PATH)
# $(DLL_IMPORTS:%=-l%)

$(cine_MODULE).exe: $(cine_OBJS)
	$(LINKER) $(cine_LDFLAGS) /OUT:$@ $(cine_OBJS) $(cine_LIBRARY_PATH) $(DEFLIB)

$(cine_MODULE).dll: $(cine_OBJS)
	$(LINKER) /DLL $(cine_LDFLAGS) /OUT:$@ $(cine_OBJS) $(cine_LIBRARY_PATH) $(DEFLIB)


